package Year22_Month03.day17;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int len = sc.nextInt();//用来标记数组长度
            int ori = sc.nextInt();//用来记录初始能力值
            int[] arr = new int[len];//用数组来保存每一只怪物的能力值
            for (int i = 0; i < len; i++) {
                arr[i] = sc.nextInt();
            }
            for (int i = 0; i < arr.length; i++) {
                if(arr[i] <= ori){
                    ori += arr[i];
                }else{
                    ori += fun(ori,arr[i]);
                }
            }
            System.out.println(ori);
        }
    }
    public static int fun(int i,int j){
        int min;
        int max;
        if(i > j){
            min = j;
            max = i;
        }else{
            min = i;
            max = j;
        }
        while (max % min != 0){
            int tmp = max % min;
            max = min;
            min = tmp;
        }
        return min;
    }


}
